package cn.gson.oasys.mappers;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface DeptMapper{
    @Update("update aoa_dept set leaf = 'N' where dept_id = #{parentId}")
    void updateLeafNById(@Param("parentId") Long parentId);

    @Select("select count(1) from aoa_dept where parent_id = (select dept_id from aoa_dept where dept_id = #{deptId})")
    int getCount(@Param("deptId") Long deptId);

    @Update("update aoa_dept set leaf = 'Y' where dept_id = #{parentId}")
    void updateLeafYById(@Param("parentId") Long parentId);
}
